package com.mnb.base.controller;

import com.mnb.base.entity.StRsvrfsrB;
import com.mnb.base.entity.StRsvrfsrB;
import com.mnb.base.service.StRsvrfsrBService;
import com.mnb.base.service.impl.StRsvrfsrBServiceImpl;
import com.mnb.common.utils.R;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * (ST_RSVRFSR_B)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/st_rsvrfsr_b")
public class StRsvrfsrBController {
    /**
     * 服务对象
     */
    @Resource
    private StRsvrfsrBService stRsvrfsrBService;


    @RequestMapping("/list")
    public R list(StRsvrfsrB stRsvrfsrB) {
        return stRsvrfsrBService.getList(stRsvrfsrB);
    }

    @RequestMapping("/insert")
    public R insert(@RequestBody StRsvrfsrB stRsvrfsrB) {
        stRsvrfsrB.setModitime(new Date());
        return stRsvrfsrBService.insert(stRsvrfsrB);
    }

    @RequestMapping("/udpate")
    public R udpate(@RequestBody StRsvrfsrB stRsvrfsrB) {
        return stRsvrfsrBService.udpate(stRsvrfsrB);
    }

    @RequestMapping("/delete")
    @Transactional
    public R delete(@RequestBody List<StRsvrfsrB> list) {
        for (StRsvrfsrB stRsvrfsrB : list) {
            stRsvrfsrBService.deleteByPrimaryKey(stRsvrfsrB.getStcd(), stRsvrfsrB.getBgmd());
        }
        return R.ok();
    }

}
